# name='皮卡丘'
# age=3
#
# print("{}{}岁啦".format(name,age))
# print("%s%d岁啦"%(name,age)

# lists = [1, 2, 3, 'a', 5]
# print(lists[len(lists)-1])
# print(lists[1:len(lists) - 2])
# lists[3] = 'b'
# print(lists)
# lists.append('c')
# print(lists)
# lists.pop(4)
# print(222222)
# lists.remove('b')
# print(lists)

# tup1 = ('a','b',3,4)
# tup2 = (1,2,3,4,5)
# print(tup1[3])
# print(tup2[0:-2])
# tup3 = tup1 + tup2
# print(tup3)
# tup4 = 'hi!'
# print(tup4*4)
#
# dicts = {"username":"zhangsan","password":123456}
#
# print(dicts.keys())
# print(dicts.values())
# print(dicts["password"])
#
# dicts = {"username":"zhangsan",'password':123456}
# dicts["age"] = 22
# print(dicts)
#
# for k, v in dicts.items():
#     print("dicts keys is %s " %k)
#     print("dicts values is %s " %v)
#
# print(dicts.items())
# dicts.pop("password")
# prin(dicts)

# a = "004A4B77224A4F118738548EC5CF7531,00FE3DEC31AF409787D3D75C2AC878C0,01FFE8D92107461A8D4933054EEB1278,05166AE83CED4FB5B65A5B8F236FF184,0245A6B5B2294C26AC3BBD840D701C7E"
# list_ids = a.split(",")
# ret = []
# for id in list_ids:
#     id = '"'+id+'"'
#     ret.append(id)
#
# print(','.join(ret))

# from time import sleep
# from selenium import webdriver
#
# driver = webdriver.Chrome()
# driver.get("http://videojs.com/")
# driver.maximize_window()
#
# video = driver.find_element("id", "preview-player_html5_api")
# text = driver.find_element('xpath','//*[@id="___gatsby"]/div/main/div[1]/div/h1')
# text.click()
# url = driver.execute_script("return arguments[0].currentSrc;",video)
# print(url)
#
# js = "window.scrollTo(600,4050)"
# driver.execute_script(js)
# print("start")
# driver.execute_script("arguments[0].play()",video)
# sleep(30)
# print("stop")


driver = webdriver.Chrome()
driver.get("https://www.helloweba.net/demo/2017/unlock/")
# 定位滑动块
slider = driver.find_elements(by=By.CLASS_NAME,value="slide-to-unlock-handle")[0]
action = ActionChains(driver)
action.click_and_hold(slider).perform()
for index in range(200):
    try:
        action.move_by_offset(400, 0).perform()
    except UnexpectedAlertPresentException:
        break
    action.reset_actions()
    sleep(0.1) # 等待停顿时间
# 打印警告框提示
success_text = driver.switch_to.alert.text
print(success_text)

# from selenium import webdriver
# from time import sleep
#
# from selenium.common.exceptions import UnexpectedAlertPresentException
# from selenium.webdriver import ActionChains
#
# driver = webdriver.Chrome()
# driver.maximize_window()
#
# driver.get("https://www.helloweba.net/demo/2017/unlock/")
#
# # 定位滑块
# slider = driver.find_elements('class_name','slide-to-unlock-handle')
# slider2 = slider[0]
# action = ActionChains(driver)
# action.click_and_hold(slider2).perform()
#
# for index in range(200):
#     try:
#         action.move_by_offset(5, 0).perform()
#     except UnexpectedAlertPresentException:
#         break
#     action.reset_actions()
#     sleep(0.1)      # 等待停顿时间

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get("https://www.baidu.com/")
# driver.find_element_by_class_name("s_ipt").send_keys("shaxzi")
driver.find_element(by=By.CLASS_NAME,value="s_ipt")
driver.find_element("","s_ipt").send_keys("selenium")
driver.find_element("id","su").click()